<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.tk.entity.Hero"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>用户登录</title>
    <meta charset="UTF-8">
		<!--<link rel="stylesheet" href="css/index.css" />-->
	<link rel="stylesheet" type="text/css" href="css/login.css"/>
	<link rel="stylesheet" type="text/css" href="css/userLogon.css"/>
	<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>
	<script type="text/javascript" src="js/getBodyWidAndHei.js" ></script>
	<script type="text/javascript" src="js/logonTrue.js" ></script>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  	<%-- 设定阵营 --%>
  	
  	<!--中间那一块登录界面的地方-->
		<div class="start">
			<div class="inforth">
				<div class="countryText">
					<%
				  		request.setCharacterEncoding("UTF-8");
				  		String team = request.getParameter("team");
				  		if(team == null)
				  			team = ((Hero)(request.getSession().getAttribute("hero"))).getTeam();
				  		if("wei".equals(team) || "魏".equals(team)) {
				  			team = "魏";
				  			out.println("<img src=\"img/login/魏.png\"/>");
				  		}
				  		else if("shu".equals(team) || "蜀".equals(team)) {
				  			team = "蜀";
				  			out.println("<img src=\"img/login/蜀.png\"/>");
				  		}
				  		
				  		else if("wu".equals(team) || "吴".equals(team)) {
				  			team = "吴";
				  			out.println("<img src=\"img/login/吴.png\"/>");
				  		} 
				  		else if("xian".equals(team) || "仙".equals(team)){
				  			team = "仙";
				  			out.println("<img src=\"img/login/神.png\"/>");
				  		}
				  		if(team == null || team.equals("")){
				  			team = (String)request.getSession().getAttribute("team");
				  		}else{
				  			request.getSession().setAttribute("team", team);
				  		}
				   		
				//    		out.println(request.getSession());
				  	%>
				</div>
				
				<!--input表单-->
				<form action="servlet/loginServlet" method="post">
					<div class="telInput">
						<input type="text" id="hid" name="hid" placeholder="请输入您的账号">
					          <div id="telWrong1"><p id="telWrong">您的账号输入错误，请重新输入</p></div>
					</div>
					<div class="passInput">
						<input type="password" id="pwd" name="pwd" placeholder="请输入您的密码">
						<div id="passWrong1"><p id="passWrong">您的密码输入错误，请重新输入</p></div>
					</div>
					
					<div class="sub">
						<input type="submit" id="signIn" value="登录" />
					</div>
			    </form>
			    
			   	<a href="index.jsp">返回首页</a>
			    
			    <div class="change">
			    	<%
				  		if(!"仙".equals(team)){
				  			out.println("<a href = \"register/register.jsp\">注册英雄</a>");
				  		}
				  	%>
				  	<%-- 输出错误 --%>
				  	<%
				  		String er = (String)request.getAttribute("error");
				  		if(er != null) out.println(er);
				  	%>
			    </div>
		    
		    </div>
		</div>
		<div class="wei">
			<img id="caoCao" src="img/index/曹操.jpg">
			
		</div>
		<div class="shu">
			<img id="liuBie" src="img/index/刘备.jpg">
		</div>
		<div class="wu">
			<img id="sunQuan" src="img/index/孙权.jpg">
		</div>
  </body>
</html>
